package com.example.demo.service.Impl;

import com.example.demo.map.SelectCourseMapper;
import com.example.demo.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class SelectCourseService implements com.example.demo.service.SelectCourseService {

    @Override
    public int insAllSelCou(int stuNo, List<Integer> couNoList) {
        SqlSession sqlSession = MybatisUtil.getSqlSession();
        SelectCourseMapper mapper = sqlSession.getMapper(SelectCourseMapper.class);
        for (Integer integer : couNoList) {
            mapper.insertSelCou(stuNo, integer);
            sqlSession.commit();
        }
        sqlSession.close();
        return 0;
    }
}
